<?php
namespace app\index\controller;
use think\Controller;//引入这个命名空间下的类
use think\Db;

class Base extends Controller//引入后继承，才能下里面的fetch()方法，引入模板
{
    public function _initialize()
    {
        $this->right();
        $cateres = Db::name('cate')->order('id desc')->select();
        $this->assign('cateres',$cateres);
    }

    public function right()
    {
        $clickres = db('article')->order('click desc')->limit(8)->select();
        $tjres = db('article')->where('state','=',1)->order('click desc')->limit(8)->select();
        $this->assign(array(
            'clickres'=>$clickres,
            'tjres'=>$tjres

        ));
    }
}
